package com.ams.service;

import com.ams.dao.UserDao;
import com.ams.pojo.User;

public class UserService {
	UserDao udao;

	public User loginUser(User user) {
		User u = null;
		User us = null;
		int i = 0;
		udao = new UserDao();
		u = udao.loginUser(user);
		if (u != null) {
			if (u.getLogintimes() == 0) {
				u.setLogintimes(1);
				i = udao.updateUser(u);
			} else {

				u.setLogintimes(u.getLogintimes() + 1);
				i = udao.updateUser(u);
			}
		}
		u = udao.loginUser(user);
		return u;
	}
}
